package com.gtd.ws

import javax.servlet.http.HttpSession
import org.springframework.web.context.request.RequestContextHolder

class SessionStorageService {
  static transactional = false
  static scope = "singleton"

  def set(key, value) {
    getSession().key = value
  }
  
  def clear(key) {
    set(key, null)
  }
  
  def get(key) {
    return getSession().key
  }

  private HttpSession getSession() {
    return RequestContextHolder.currentRequestAttributes().getSession()
  }

}
